<?php
namespace Tbf\Bundle\DatabaseBundle\Orm;
use Doctrine\ORM\QueryBuilder;

/**
 * QueryBuilder helper function
 */
class QueryBuilderHelper {
    public static $place_holder_num =0;
    public static function placeHolderIn(QueryBuilder $qb,$x,array $y){
        $value_list = array();
        foreach($y as $v1){
            $value_list[] = self::placeHolderValue($qb,$v1);
        }
        return $x.' IN ('.implode(',',$value_list).')';
    }
    public static function placeHolderValue(QueryBuilder $qb,$v){
        self::$place_holder_num+=1;
        $ph_string = ':ph_'.self::$place_holder_num;
        $qb->setParameter($ph_string,$v);
        return $ph_string;
    }
}